package com.yuwei.controller;

import com.alibaba.fastjson.JSON;
import com.yuwei.bean.RetMessage;
import com.yuwei.bean.User;
import com.yuwei.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    LoginService loginService;

    @PostMapping("/login")
    public String login(@RequestBody  User user) {
        RetMessage retMsg = loginService.login(user);
        return JSON.toJSONString(retMsg);
    }
}
